home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / CLASSSRC.PAK / WSYSCLS.CPP < prev    next >
C/C++ Source or Header  |  1997-05-06  |  2KB  |  54 lines

  1. //----------------------------------------------------------------------------
  2. // Borland WinSys Library
  3. // Copyright (c) 1993, 1997 by Borland International, All Rights Reserved
  4. //
  5. //$Revision:   5.5  $
  6. //
  7. // Implementation of window system structure and type encapsulation
  8. //----------------------------------------------------------------------------
  9. #include <winsys/pch.h>
  10. #include <winsys/wsyscls.h>
  11. #include <services/memory.h>
  12.  
  13. //
  14. // Drag / Drop support
  15. //
  16. TFileDroplet::TFileDroplet(const _TCHAR* fileName, TPoint& p, bool inClient)
  17. :
  18.   FileName(strnewdup(fileName)),
  19.   Point(p),
  20.   InClientArea(inClient)
  21. {
  22. }
  23.  
  24. //
  25. // Construct a TFileDroplet given a DropInfo and a file index
  26. //
  27. // The location is relative to the client coordinates, and will have negative
  28. // values if dropped in the non client partsof the window.
  29. //
  30. // DragQueryPoint copies that point where the file was dropped and returns
  31. // whether or not the point is in the client area.  Regardless of whether or
  32. // not the file is dropped in the client or non-client area of the window,
  33. // you will still receive the file name.
  34. //
  35. TFileDroplet::TFileDroplet(TDropInfo& drop, int i)
  36. {
  37.   // Tell DragQueryFile the file wanted (i) and the length of the buffer.
  38.   //
  39.   int  namelen = drop.DragQueryFileNameLen(i) + 1;
  40.   FileName = new _TCHAR[namelen];
  41.  
  42.   drop.DragQueryFile(i, FileName, namelen);
  43.  
  44.   InClientArea = drop.DragQueryPoint(Point);
  45. }
  46.  
  47. //
  48. // Clean up the new'd filename
  49. //
  50. TFileDroplet::~TFileDroplet()
  51. {
  52.   delete[] FileName;
  53. }
  54.